import React, { Component } from "react";
import { NavLink, withRouter } from "react-router-dom";
import { observer, inject } from "mobx-react";

@withRouter
@inject("first", "two", "newStore", "obser")
@observer
class View extends Component {
  getStore() {
    // console.log(this.props.first, this.props.two);
  }
  componentDidMount() {
    this.getStore();
  }
  setShe(e, txt) {
    const { setName } = this.props.obser;
    setName(txt);
  }
  render() {
    let { name } = this.props.newStore;
    return (
      <React.Fragment>
        <NavLink to="storepage">storepage</NavLink>
        <NavLink to="newstore">newstore</NavLink>
        <NavLink to="page">page</NavLink>
        <div>他的名字：{name}</div>
        <div>她的名字：{this.props.obser.name}</div>
        <input
          type="button"
          value="修改她"
          onClick={(e, txt) => {
            this.setShe(e, "小粉");
          }}
        />
      </React.Fragment>
    );
  }
}
export default View;
